import 'package:mybase/base/tool/entitylog/MyEntityLog.dart';

import 'FFDefaultSql.dart';
import 'FFsql.dart';

/**
 * 实体类 with FFDefaultSql, FFSQlEntityDefault
 */
class FFDemoEntity with FFDefaultSql, FFSQlEntityDefault {
  String? a;
  String? b;

  FFDemoEntity({
    this.a,
    this.b,
  });

  FFDemoEntity.fromJson(Map<String, dynamic> json) {
    a = MyEntityLog.handleString(json, 'a');
    b = MyEntityLog.handleString(json, 'b');
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['a'] = this.a;
    data['b'] = this.b;
    return data;
  }

  // 1
  @override
  String getTableName() {
    return "DemoEntity";
  }

  // 2
  @override
  FFDemoEntity mapToEntity(Map<String, dynamic> map) {
    var entity = FFDemoEntity.fromJson(map);
    // 这句一定要调用
    entity.superColumn(entity, map);
    return entity;
  }
}
